import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
import userRouter from './modules/user';
import difficultRouter from './modules/difficult';
import newsRouter from './modules/news';
import jobFairRouter from "./modules/jobFair";
import mineRouter from './modules/mine'
import enterpriseRouter from './modules/enterprise'
import imRouter from './modules/im'
import positionRouter from './modules/position'
import personalRouter from './modules/personal';
import jobCareersRouter from '@/router/modules/jobCareers';
import skillRouter from '@/router/modules/skill'
import liveRouter from '@/router/modules/live'
const router = new VueRouter({
    routes: [
        ...userRouter,
        ...difficultRouter,
        ...newsRouter,
        ...jobFairRouter,
        ...mineRouter,
        ...enterpriseRouter,
        ...imRouter,
        ...positionRouter,
        ...personalRouter,
        ...jobCareersRouter,
        ...skillRouter,
        ...liveRouter,
        {
            name:'Home',
            path:'/home/index',
            component:()=>import('@/pages/home/index')
        },
        {
            name:'Login',
            path:'/user/login',
            component:()=>import('@/pages/user/login')
        },
        {
            name:'404',
            path:'/404',
            component:()=>import('@/pages/error-page/404')
        },
        { path: '*'}
    ]
});
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
    if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
    return originalPush.call(this, location).catch(err => err)
}
export default router;
